﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;

public class tbAssessmentDetailDB
{
    #region[tbAssessmentDetail_Add]
    public static bool tbAssessmentDetail_Add(tbAssessmentDetailDATA _tbAssessmentDetailDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_Add", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@assId", _tbAssessmentDetailDATA.assId));
                dbCmd.Parameters.Add(new SqlParameter("@criId", _tbAssessmentDetailDATA.criId));
                dbCmd.Parameters.Add(new SqlParameter("@adePoint", _tbAssessmentDetailDATA.adePoint));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercent", _tbAssessmentDetailDATA.adePointPercent));
                dbCmd.Parameters.Add(new SqlParameter("@adePointLD", _tbAssessmentDetailDATA.adePointLD));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD", _tbAssessmentDetailDATA.adePointPercentLD));
                dbCmd.Parameters.Add(new SqlParameter("@adePointLD_1", _tbAssessmentDetailDATA.adePointLD_1));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD_1", _tbAssessmentDetailDATA.adePointPercentLD_1));
                dbCmd.Parameters.Add(new SqlParameter("@adeTotalpointPercent", _tbAssessmentDetailDATA.adeTotalpointPercent));
                dbCmd.Parameters.Add(new SqlParameter("@adeType", _tbAssessmentDetailDATA.adeType));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbAssessmentDetail_Update_PointLD]
    public static bool tbAssessmentDetail_Update_PointLD(tbAssessmentDetailDATA _tbAssessmentDetailDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_Update_PointLD", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@adeId", _tbAssessmentDetailDATA.adeId));
                dbCmd.Parameters.Add(new SqlParameter("@adePointLD", _tbAssessmentDetailDATA.adePointLD));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD", _tbAssessmentDetailDATA.adePointPercentLD));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD_1", _tbAssessmentDetailDATA.adePointPercentLD_1));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    public static bool tbAssessmentDetail_Update_PointLD_1(tbAssessmentDetailDATA _tbAssessmentDetailDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_Update_PointLD_1", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@adeId", _tbAssessmentDetailDATA.adeId));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD", _tbAssessmentDetailDATA.adePointPercentLD));
                dbCmd.Parameters.Add(new SqlParameter("@adePointLD_1", _tbAssessmentDetailDATA.adePointLD_1));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercentLD_1", _tbAssessmentDetailDATA.adePointPercentLD_1));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbAssessmentDetail_Update_PointuID]
    public static bool tbAssessmentDetail_Update_PointuID(tbAssessmentDetailDATA _tbAssessmentDetailDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_Update_PointuID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@adeId", _tbAssessmentDetailDATA.adeId));
                dbCmd.Parameters.Add(new SqlParameter("@adePoint", _tbAssessmentDetailDATA.adePoint));
                dbCmd.Parameters.Add(new SqlParameter("@adePointPercent", _tbAssessmentDetailDATA.adePointPercent));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbAssessmentDetail_Delete]
    public static bool tbAssessmentDetail_Delete(string adeId)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_Delete", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@adeId", adeId));
                dbConn.Open();
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbAssessmentDetail_GetByID]
    public static List<tbAssessmentDetailDATA> tbAssessmentDetail_GetByID(string adeId)
    {
        List<tbAssessmentDetailDATA> list = new List<tbAssessmentDetailDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_GetByID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@adeId", adeId));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbAssessmentDetailDATA objtbAssessmentDetailDATA = new tbAssessmentDetailDATA(
                        reader["adeId"].ToString(),
                        reader["assId"].ToString(),
                        reader["criId"].ToString(),
                        reader["adePoint"].ToString(),
                        reader["adePointPercent"].ToString(),
                        reader["adePointLD"].ToString(),
                        reader["adePointPercentLD"].ToString(),
                        reader["adePointLD_1"].ToString(),
                        reader["adePointPercentLD_1"].ToString(),
                        reader["adeTotalpointPercent"].ToString(),
                        reader["adeType"].ToString());
                        list.Add(objtbAssessmentDetailDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbAssessmentDetail_GetByassId]
    public static List<tbAssessmentDetailDATA> tbAssessmentDetail_GetByassId(string assId)
    {
        List<tbAssessmentDetailDATA> list = new List<tbAssessmentDetailDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_GetByassId", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@assId", assId));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbAssessmentDetailDATA objtbAssessmentDetailDATA = new tbAssessmentDetailDATA(
                        reader["adeId"].ToString(),
                        reader["assId"].ToString(),
                        reader["criId"].ToString(),
                        reader["adePoint"].ToString(),
                        reader["adePointPercent"].ToString(),
                        reader["adePointLD"].ToString(),
                        reader["adePointPercentLD"].ToString(),
                        reader["adePointLD_1"].ToString(),
                        reader["adePointPercentLD_1"].ToString(),
                        reader["adeTotalpointPercent"].ToString(),
                        reader["adeType"].ToString(),
                        reader["criName"].ToString());
                        list.Add(objtbAssessmentDetailDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbAssessmentDetail_GetByuID]
    public static List<tbAssessmentDetailDATA> tbAssessmentDetail_GetByuID(string uID, string criId)
    {
        List<tbAssessmentDetailDATA> list = new List<tbAssessmentDetailDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbAssessmentDetail_GetByuID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                dbCmd.Parameters.Add(new SqlParameter("@criId", criId));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbAssessmentDetailDATA objtbAssessmentDetailDATA = new tbAssessmentDetailDATA(
                        reader["adeId"].ToString(),
                        reader["assId"].ToString(),
                        reader["criId"].ToString(),
                        reader["adePoint"].ToString(),
                        reader["adePointPercent"].ToString(),
                        reader["adePointLD"].ToString(),
                        reader["adePointPercentLD"].ToString(),
                        reader["adePointLD_1"].ToString(),
                        reader["adePointPercentLD_1"].ToString(),
                        reader["adeTotalpointPercent"].ToString(),
                        reader["adeType"].ToString());
                        list.Add(objtbAssessmentDetailDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
}
